package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.domain.ProjectInitiation;
import com.blrs.service.project.initiation.IProjectInitiationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 项目信息Controller
 *
 * @date 2025-01-14
 */
@RestController
@RequestMapping("/project/initiation")
public class ProjectInitiationController extends BaseController
{
    @Autowired
    private IProjectInitiationService projectInitiationService;

    /**
     * 查询项目信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ProjectInitiation projectInitiation)
    {
        startPage();
        List<ProjectInitiation> list = projectInitiationService.selectProjectInitiationList(projectInitiation);
        return getDataTable(list);
    }


    /**
     * 获取项目信息详细信息
     */
    @GetMapping(value = "/{projectId}")
    public AjaxResult getInfo(@PathVariable("projectId") String projectId)
    {
        return success(projectInitiationService.selectProjectInitiationById(projectId));
    }


    /**
     * 修改项目信息
     */
    @Log(title = "项目信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProjectInitiation projectInitiation)
    {
        return toAjax(projectInitiationService.updateProjectInitiation(projectInitiation));
    }

}
